package com.lfx.kube.web;

import com.lfx.kube.db.IStudentDbService;
import com.lfx.kube.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 李逢喜
 * create 2021/7/7
 */
@RequestMapping("student")
@RestController
public class StudentController {

    @Autowired
    private IStudentDbService iStudentDbService;


    @GetMapping("list")
    public List<Student> list(){
       return iStudentDbService.list();
    }



    @PostMapping("insert")
    public boolean insert(@RequestBody Student student){
        return iStudentDbService.save(student);
    }



    @PutMapping("update")
    public boolean update(@RequestBody Student student){
        return iStudentDbService.updateById(student);
    }




    @DeleteMapping("delete/{userid}")
    public boolean update(@PathVariable("userid")Integer userid){
        return iStudentDbService.removeById(userid);
    }

}
